
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="js/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="js/css/main.css"/>
    <script src="js/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="js/js/libs/modernizr.min.js"></script>
    <script src="js/jquery.validation/1.14.0/jquery.validate.min.js"></script>
<script src="js/jquery.validation/1.14.0/messages_zh.min.js"></script>
<script src="js/layer/layer.js" charset="utf-8"></script>
</head>
<body>
<div class="topbar-wrap white">
    <div class="topbar-inner clearfix">
        <div class="topbar-logo-wrap clearfix">
            <h1 class="topbar-logo none"><a href="index.html" class="navbar-brand">后台管理</a></h1>
        </div>
    </div>
</div>
<div class="container clearfix">
    <div class="sidebar-wrap">
        <div class="sidebar-title">
            <h1>菜单</h1>
        </div>
        <div class="sidebar-content">
            <ul class="sidebar-list">
                <li>
                    <a href="#"><i class="icon-font">&#xe003;</i>常用操作</a>
                    <ul class="sub-menu">
                        <li><a href="getStudentById?id=${student.id}"><i class="icon-font">&#xe008;</i>个人信息</a></li>
                        <li><a href="getScore?id=${student.id}"><i class="icon-font">&#xe005;</i>成绩查询</a></li>
                        <li><a href="getTeacher?id=${student.id}"><i class="icon-font">&#xe006;</i>教师信息</a></li>
                    </ul>
                </li>
                <li>
                    <a href="#"><i class="icon-font">&#xe018;</i>系统管理</a>
                    <ul class="sub-menu">
                        <li><a href="studup?id=${student.id}"><i class="icon-font">&#xe017;</i>个人信息设置</a></li>
                        <li><a href="upwd?id=${student.id}"><i class="icon-font">&#xe037;</i>修改密码</a></li>
                        
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="index.html">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">修改密码</span></div>
        </div>
      
        <div class="result-wrap">
            <form name="myform" id="myform"  method="post">
               
                <div class="result-content">
						<table class="insert-tab" width="100%">
							<tbody>
								<tr>
									<th></th>
									<td>请谨慎修改密码</td>
								</tr>
								<tr>
									<th><i class="require-red">*</i>旧密码：</th>
									<td><input class="common-text required" id="opwd"
										name="opwd" size="50"  type="password">
										<span id="message"></span>
									</td>
								</tr>
								<tr>
									<th><i class="require-red">*</i>新密码：</th>
									<td><input class="common-text required" id="npwd"
										name="npwd" size="50"  type="password">
									</td>
								</tr>
								<tr>
									<th><i class="require-red">*</i>再次输入新密码：</th>
									<td><input class="common-text required" id="pwd"
										name="pwd" size="50"  type="password">
									</td>
								</tr>
								<tr>
									<th></th>
									<td><input class="btn btn-primary btn6 mr10" id="upbutton"
										value="确认" type="button"> <input class="btn btn6"
										onclick="fanhui()" value="返回" type="button"></td>
								</tr>
							</tbody>
						</table>
                    </div>
               
            </form>
        </div>
    </div>
    <!--/main-->

</body>
<script type="text/javascript">
$(function() {
	$("#opwd")
			.blur(function() {
				//文本框值
					var pwd = $("#opwd").val();
       $.getJSON("findPwdById?id="+${student.id}+"&pwd="+pwd,function(result){$("#message").html(result.msg);
       if(result.msg!=""){
       
       document.getElementById("opwd").value="";}}
     
       ); 
        
         
				});
				
				
				
}); 
$().ready(function() {
	/*返回一个validate对象，这个对象有一个form方法，返回的是是否通过验证*/
	return $("#myform").validate({
		rules : {
			npwd : {
				required : true,
				maxlength : 15,
				minlength : 6
			},
			pwd : {
				required : true,
				maxlength : 15,
				minlength : 6,
				 equalTo: "#npwd"
			},
			opwd : {
				required : true,
				minlength:1
			}

		},
		messages : {
			opwd : {
				required : "旧密码不能为空"
			},
			npwd : {
				required : "请输入新密码",
				minlength: "确认密码不能小于6个字符",
			},
			pwd : {
				required : "请再次输入新密码",
				 minlength: "确认密码不能小于6个字符",
			        equalTo: "两次输入密码不一致"

			}
		}
	});
})
$(function(){



		  $('#upbutton').click(function(){//点击按钮提交

		                                        //要提交的表单id为form1

		                   

		            $.ajax({

		                 url:"stupwd?id=${student.id}",

		                 data:{
		                	 "pwd":$("#pwd").val()
		                	 },

		                 type:"post",

		                 success:function(data){
		                	 layer.alert("密码修改成功", {icon: 6});
		                 }

		            });     

		        });


		});
		function fanhui(){
			 window.history.go(-1) ;
			
		}

</script>
</html>